<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0027)http://www.chinaidcard.com/ -->
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <title>驾驶申请表</title>
    <link href="../../layui/css/layui.css" rel="stylesheet">
    <link href="css/layuiAdmin.css" rel="stylesheet">
    <link href="../../static/css/style.css" rel="stylesheet">
    <script src="../../static/js/jquery.min.js"></script>
    <script src="../../static/js/jquery.cookie.js"></script>
    <script src="../../layui/layui.js"></script>
    <script src="../../static/js/base.js"></script>
    <script src="../../static/js/ax.js"></script>
    <script src="../../static/js/avalon.js"></script>
    <script src="js/constant.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.js"></script>
    <script src="../../static/js/respond.js"></script>
    <![endif]-->
    <style>
        .layui-upload-img{
            overflow: hidden
        }
    </style>

</head>

<body class="bg_w">

<div class="layui-fluid">
    <div class="layui-card">
        <div class="content-wrap" ms-controller="test">
            <form class="layui-form layui-form-pane" action="">
                <div class="layui-row add_student layui-form-item ">
                    <div class="layui-col-md10">
                        <div class="">
                            <!----1-->
                            <div class="layui-row">
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">姓名：</label>
                                    <div class="layui-input-block" style="position: relative;">
                                        <input type="text" maxlength="50" lay-verify="required"  ms-duplex="@name" name="Name" class="layui-input">
                                        <input id="Button"  class="layui-btn add_btn layui-btn-radius" type="button" value="读   卡" onclick="return Button1_onclick()"
                                               style="position: absolute;right:2px;top: 4px; line-height: 30px; height: 30px;"
                                        />
                                        <img src="" style="width: 91px; height: 108px; display: none;" name="pic" />
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">证件类型：</label>
                                    <div class="layui-input-block">
                                        <select name="sfType" id="sfType" ms-duplex="@sfType" lay-verify="required" lay-filter="aihao">
                                            <option value="">请选择</option>

                                        </select>
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">出生日期：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Born"  ms-duplex="@birthday" class="layui-input">
                                    </div>
                                </div>


                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">证件号码：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input"  ms-duplex="@certificatesNumber" name="CardNo">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">国籍：</label>
                                    <div class="layui-input-block">
                                        <select name="country" lay-verify="required" lay-filter="county" ms-duplex="@country" lay-filter="aihao">
                                            <option value="">请选择</option>
                                            <option value="重庆">重庆</option>
                                            <option value="四川">四川</option>
                                            <option value="云南">云南</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">身份证有效期至：</label>
                                    <div class="layui-input-block">
                                        <!--<input type="text"  class="layui-input" lay-verify="required" ms-duplex="@effectedDate" name="EffectedDate" style="width: 44%;display: inline-block; float: left;">-->
                                        <!--<span style="float: left; width: 2%; line-height: 38px; text-align: center;">&nbsp;~&nbsp;</span>-->
                                        <input type="text" lay-verify="required"  ms-duplex="@expiredDate" class="layui-input"
                                               name="ExpiredDate">
                                    </div>
                                </div>




                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">性别：</label>
                                    <div class="layui-input-block">
                                        <!--<input type="text" class="layui-input" lay-verify="required"  ms-duplex="@sex" name="Sex">-->
                                        <input type="radio" name="Sex" ms-duplex="@sex" value="1" title="男">
                                        <input type="radio" name="Sex" ms-duplex="@sex" value="2" title="女">
                                    </div>
                                </div>
                                <div class="layui-col-lg8 layui-col-md6 layui-xs12">
                                    <div class="layui-form-item" pane style="margin-bottom: 0;">
                                        <label class="layui-form-label">学习类别：</label>
                                        <div class="layui-input-block">
                                            <input type="radio" name="stu" ms-duplex="@studyType" value="first" title="初次申领">
                                            <input type="radio" name="stu" ms-duplex="@studyType" value="add" title="增驾">
                                        </div>
                                    </div>

                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">手机号码：</label>
                                    <div class="layui-input-block">
                                        <input type="text"  lay-verify="required|phone" maxlength="11" class="layui-input" ms-duplex="@phone" name="phone">
                                    </div>
                                </div>


                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">准驾车型：</label>
                                    <div class="layui-input-block" >
                                        <select name="carId" id="carId" lay-verify="required" ms-duplex="@carId" lay-verify="required" lay-filter="aihao">    <option value="">请选择</option>

                                        </select>
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">暂住证编号：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" lay-verify="required" ms-duplex="@stayAddreeNumber" name="stayAddreeNumber">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">电子邮箱：</label>
                                    <div class="layui-input-block">
                                        <input type="text" lay-verify="required|email" class="layui-input" ms-duplex="@email" name="email">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">所属辖区：</label>
                                    <div class="layui-input-block">
                                        <select>
                                            <option value="">请选择</option>

                                        </select>
                                    </div>
                                </div>


                                <!--<div class="layui-col-lg4 layui-col-md6 layui-xs12">-->
                                <!--<label class="layui-form-label">所属辖区：</label>-->
                                <!--<div class="layui-input-block  ">-->
                                <!--<div class="layui-input " style="padding: 0; box-sizing: border-box;     border: 0;">-->
                                <!--<div class="layui-col-lg4 layui-col-md4 layui-xs4" style="width: 33.33%;float: left;">-->
                                <!--<select lay-filter="provinceSelect" lay-verify="required" id='driverprovinceId' ms-duplex="@provId_1">-->
                                <!--<option value="">请选择</option>-->
                                <!--<option ms-attr="{value: el.id}" ms-for="($index, el) in @provlist">{{el.name}}</option>-->
                                <!--</select>-->
                                <!--</div>-->
                                <!--<div class="layui-col-lg4 layui-col-md4 layui-xs4" style="width: 33.33%;float: left;">-->
                                <!--<select lay-filter="regionSelect_ae" lay-verify="required" id='drivercityId' ms-duplex="@cityId_1">-->
                                <!--<option value="">请选择</option>-->
                                <!--<option ms-attr="{value: el.id}" ms-for="($index, el) in @citylist">{{el.name}}</option>-->
                                <!--</select>-->
                                <!--</div>-->
                                <!--<div class="layui-col-lg4 layui-col-md4 layui-xs4" style="width: 33.33%;float: left;">-->
                                <!--<select lay-filter="areaSelect"  lay-verify="required"  id='driverareaId' ms-duplex="@areaId_1">-->
                                <!--<option value="">请选择</option>-->
                                <!--<option ms-attr="{value: el.id}" ms-for="($index, el) in @arealist">{{el.name}}</option>-->
                                <!--</select>-->
                                <!--</div>-->
                                <!--<div class="clear:both"></div>-->
                                <!--</div>-->

                                <!--</div>-->
                                <!--</div>-->

                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">

                                    <label class="layui-form-label">住所详细地址：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" ms-duplex="@addressDetailed" name="addressDetailed">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">报名来源：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" ms-duplex="@registeredSource" name="registeredSource">
                                    </div>
                                </div>


                                <div class="layui-col-lg8 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">登记住所行政区划：</label>
                                    <div class="layui-input-block">
                                        <div class="layui-input " style="padding: 0; box-sizing: border-box;     border: 0;">
                                            <div class="layui-col-lg4 layui-col-md4 layui-xs4" style="width: 33.33%;float: left;">
                                                <select lay-filter="provinceSelect_tow" lay-verify="required" id='driverprovinceId_tow' ms-duplex="@provId_2">
                                                    <option value="">请选择</option>
                                                    <option ms-attr="{value: el.id}" ms-for="($index, el) in @provlist">{{el.name}}</option>
                                                </select>
                                            </div>
                                            <div class="layui-col-lg4 layui-col-md4 layui-xs4" style="width: 33.33%;float: left;">
                                                <select lay-filter="regionSelect_tow" lay-verify="required" id='drivercityId_tow' ms-duplex="@cityId_1">
                                                    <option value="">请选择</option>
                                                    <option ms-attr="{value: el.id}" ms-for="($index, el) in @citylist_tow">{{el.name}}</option>
                                                </select>
                                            </div>
                                            <div class="layui-col-lg4 layui-col-md4 layui-xs4" style="width: 33.33%;float: left;">
                                                <select lay-filter="areaSelect_tow" lay-verify="required" id='driverareaId_tow' ms-duplex="@areaId_1">
                                                    <option value="">请选择</option>
                                                    <option ms-attr="{value: el.id}" ms-for="($index, el) in @arealist_tow">{{el.name}}</option>
                                                </select>
                                            </div>
                                            <div class="clear:both"></div>
                                        </div>

                                    </div>
                                </div>
                                <div class="layui-col-lg8 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">登记住所详细地址：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" readonly ms-duplex="@registeredResidence" name="Address">
                                        <input id="Button1" readonly class="layui-btn add_btn layui-btn-radius" :click="opeenlay()" type="button" value="非本地"
                                               style="position: absolute;right:2px;top: 4px; line-height: 30px; height: 30px;"
                                        />
                                        <!-- <input type="text" class="layui-input" name="registeredResidence" ms-duplex="@registeredResidence"> -->
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">来源：</label>
                                    <div class="layui-input-block">
                                        <!--  <input type="text" class="layui-input" name="field">-->
                                        <input type="text" class="layui-input" id="layerResult"  name="studentSource" ms-duplex="@registeredSource">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">学费：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="registeredTuition" ms-duplex="@registeredTuition">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">学员编号：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="studentNumber" ms-duplex="@studentNumber" id="studentNumber">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">报名日期：</label>
                                    <div class="layui-input-block">
                                        <input type="text" readonly class="layui-input" ms-duplex="@registeredTime" value="<%=new SimpleDateFormat('yyyy-MM-dd').format(new Date()) %>"
                                               name="registeredTime" id="registeredTime">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">(驾校)结构名称：</label>
                                    <div class="layui-input-block">
                                        <input type="text" readonly class="layui-input" name="driversId" id="driversId">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">推荐码：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" ms-duplex="@referralCode" name="referralCode">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">民族：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" readonly ms-duplex="@nation" name="Nation">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">签发机关：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" readonly readonly ms-duplex="@IssuedAt" name="IssuedAt">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">模块号码：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" readonly ms-duplex="@SAMID" name="SAMID">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">照片编码：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" readonly ms-duplex="@picture" name="Picture">
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                    <label class="layui-form-label">编码长度：</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" readonly ms-duplex="@PictureLen" name="PictureLen">
                                    </div>
                                </div>
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label" style="height: 120px; line-height: 120px;">备注</label>
                                    <div class="layui-input-block">
                                        <textarea name="reason" ms-duplex="@reason" placeholder="请输入内容" style="height: 120px;" class="layui-textarea" style="min-height: 135px;"></textarea>
                                    </div>
                                </div>

                            </div>

                            <!-- <div class="layui-col-lg4 layui-col-md6 layui-xs12">
                                <label class="layui-form-label">地址：</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" readonly ms-duplex="@address" name="Address">
                                </div>
                            </div> -->

                        </div>
                    </div>

                    <div class="layui-col-md2">
                        <div style="width: 100%; height: auto; padding: 20px 5%; box-sizing: border-box;-webkit-box-sizing: border-box;">
                            <img src="../../static/images/add_img.jpg" style="max-width: 100%; margin: 0 auto;display: block;">
                        </div>


                        <!--<div class="layui-upload">-->
                        <!--<div class="layui-upload-list fileItem" style="visibility:inherit;">-->
                        <!--<div class="layui-upload-img" style="visibility:inherit;height: 100px;" class="layui-upload-img">-->
                        <!--<img  ms-if="@sfzdzz" ms-attr="{src:@fileShowUrl +'?id='+@sfzdzz}">-->
                        <!--</div>-->
                        <!--<i class="layui-icon layui-icon-close" ms-if="@sfzdzz" :click="removeimg('sfzdzz')"></i>-->
                        <!--<input type="hidden" name="sfzdzzId" id="sfzdzzId" />-->
                        <!--<input type="hidden" name="sfzdzzType" id="sfzdzzType" value="sfzdzz" />-->
                        <!--</div>-->
                        <!--<a type="button" class="layui-btn layui-btn-primary filebtn" :click="uploadss('sfzdzz')">上传图片</a>-->
                        <!--</div>-->
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
</div>

</body>

<script>

    var vm = avalon.define({
        $id: "test",
        name: '',//姓名
        sex: '',//性别
        nation: '',//民族
        birthday: '',//出生日期：
        address: '',//地址  身份证上的地址
        certificatesNumber: '',//证件号码
        issuedAt: '',//签发机关
        effectedDate: '',//身份证有效期 开始
        expiredDate: '',//身份证有效期 结束
        picture: '',//图片编码
        sfType: '',//证件类型
        country: '',//国籍
        studyType: 'first',//学习类别
        phone: '',//手机号码
        carId: '',//准驾车型
        stayAddreeNumber: '',//暂住证编号：
        email: '',//电子邮箱
        registeredAreaId: '',//所属辖区
        addressDetailed: '',//住所详细地址：
        registeredSource: '',//报名来源
        registeredRegionId: '',//登记住所行政区划：
        registeredResidence: '',//登记住所详细地址：
        studentSource: 'local',//来源
        registeredTuition: '',//学费
        studentNumber: '',//学员编号
        registeredTime: '',//报名日期
        //  driversId : document.all['driversId'].value,//(驾校)结构名称  后台获取
        referralCode: '',//(推荐码
        reason: '',//(备注
        myState: '', //提交给谁
        SAMID: '',//模块号码：
        PictureLen: '',//编码长度
        sfz: '',//身份证头像
        mqb: '',//互联网面签协议
        cxjs: '',//初学驾驶申请表
        zjjs: '',//增驾驾驶申请表
        zw: '',//指纹
        ljz: '',//原驾驶证
        zzz: '',//制证照
        pxjl: '',//培训记录
        xszm: '',//学时证明
        zzpermit: '',//居住证照片
        idz: '',//身份证正面
        idf: '',//身份证反面
        healthForm: '',//体检表
        scenePhotos: '',//现场照片
        zjzo: '',//证件照
        tjbtp: '',//提交表图片
        sfzdzz: '',//身份证电子照片
        zcbmqz: '',//册表面签照
        provId_1: '',
        cityId_1: '',
        areaId_1: '',
        provId_2: '',
        cityId_2: '',
        areaId_2: '',
        provlist: [],
        citylist: [],
        arealist: [],
        infolist: [],
        citylist_tow: [],
        arealist_tow: [],
        pro_city_are: {},
        type: '',
        fileShowUrl: fileShowUrl,
        getRegionTree: function () {
            $.ajax({
                url: '../../static/js/addreess.text',  //文件地址
                type: 'GET',     //数据传递方式
                async: false,
                success: function (data) {  //获取数据成功执行的函数
                    var data = JSON.parse(data);
                    var city = data.city;
                    var area = data.area;
                    vm.provlist = data.prove;
                    vm.pro_city_are = data;
                    for (var i in city) {
                        if (city[i].parentId == data.prove[0].id) {
                            vm.citylist.push(city[i])
                            vm.citylist_tow.push(city[i])
                        }
                    }
                    for (var i in area) {
                        if (area[i].parentId == data.city[0].id) {
                            vm.arealist.push(area[i])
                            vm.arealist_tow.push(area[i])
                        }
                    }
                }
            })
        },
        uploadss: function (type) {
            console.log(type)
            vm.type = type;
            $('#upload').click()
        },
        removeimg:function(type){
            vm.type=type;
            if (vm.type == 'cxjs') {
                vm.cxjs = ''
            }
            if (vm.type == 'mqb') {
                vm.mqb = ''
            }
            if (vm.type == 'zw') {
                vm.zw =''
            }
            if (vm.type == 'zjzo') {
                vm.zjzo =''
            }
            if (vm.type == 'ljz') {
                vm.ljz = ''
            }
            if (vm.type == 'idz') {
                vm.idz =''
            }
            if (vm.type == 'idf') {
                vm.idf = ''
            }
            if (vm.type == 'tjbtp') {
                vm.tjbtp = ''
            }
            if (vm.type == 'scenePhotos') {
                vm.scenePhotos = ''
            }
            if (vm.type == 'sfzdzz') {
                vm.sfzdzz = ''
            }
            if (vm.type == 'zcbmqz') {
                vm.zcbmqz = ''
            }
            if (vm.type == 'zzpermit') {
                vm.zzpermit =''
            }

        },
        opeenlay:function(){
            layui.layer.open({
                id:'',
                title : "非本地户籍区域选择",
                type : 2,
                area: ['850px', '350px'],
                // btn:'确定','取消 ['],
                content : "positionList.html",
                yes: function (index,layero) {

                    layer.close(index);
                } ,
                btn2: function (index,layero) {
                    layer.close(index);
                }
            });
        },
        //面签弹窗
        mianqian:function () {
            top.layui.layer.open({
                id:'',
                title : "非本地户籍区域选择",
                type : 2,
                area: ['850px', '350px'],
                // btn:'确定','取消 ['],
                content : "./school/student/face.html",
                yes: function (index,layero) {

                    layer.close(index);
                } ,
                btn2: function (index,layero) {
                    layer.close(index);
                }
            });
        }

    })

    vm.$watch('onReady', function () {
        //获取省市区
        console.log(11)
        vm.getRegionTree();

    })
    //图片上传



    var table;
    var layer;
    var baseData = null;
    var form;
    var zpType;
    var upload;

    layui.use(['form', 'laydate', 'layer', 'upload'], function () {
        table = layui.table;
        layer = layui.layer;
        form = layui.form,
            upload = layui.upload,
            laydate = layui.laydate;

        //获取当前时间
        var d = new Date();
        var timenow = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
        document.getElementById('registeredTime').value = timenow;
        //省改变
        form.on('select(provinceSelect)', function (data) {
            console.log(data)
            var provinceid = data.value;

            vm.citylist.clear();
            vm.arealist.clear();
            for (var i in vm.pro_city_are.city) {
                if (provinceid == vm.pro_city_are.city[i].parentId) {
                    vm.citylist.push(vm.pro_city_are.city[i])
                }
            }
            var cityid = vm.citylist[0].id;
            for (var i in vm.pro_city_are.area) {
                if (cityid == vm.pro_city_are.area[i].parentId) {
                    vm.arealist.push(vm.pro_city_are.area[i])
                }
            }
            form.render('select');
            vm.provId_1 = data.value;
        });
        // 市改变
        form.on('select(regionSelect_ae)', function (data) {
            var cityid = data.value;
            return false;
            vm.arealist.clear();
            for (var i in vm.pro_city_are.area) {
                if (cityid == vm.pro_city_are.area[i].parentId) {
                    vm.arealist.push(vm.pro_city_are.area[i])
                }
            }
            form.render('select');
            vm.cityId_1 = data.value;

        });
        // 区改变
        form.on('select(areaSelect)', function (data) {
            vm.areaId_1 = data.value;

        });
        // 省改变
        form.on('select(provinceSelect_tow)', function (data) {
            console.log(data)
            vm.citylist_tow.clear();

            var provinceid = data.value

            for (var i in vm.pro_city_are.city) {
                if (provinceid == vm.pro_city_are.city[i].parentId) {
                    vm.citylist_tow.push(vm.pro_city_are.city[i])
                }
            }
            vm.arealist_tow.clear();
            vm.provId_2 = data.value;
            form.render('select');

        });
        // 市改变
        form.on('select(regionSelect_tow)', function (data) {
            var cityid = data.value;
            vm.arealist_tow.clear();
            for (var i in vm.pro_city_are.area) {
                if (cityid == vm.pro_city_are.area[i].parentId) {
                    vm.arealist_tow.push(vm.pro_city_are.area[i])
                }
            }
            form.render('select');
            vm.cityId_2 = data.value;
        });
        // 区改变
        form.on('select(areaSelect_tow)', function (data) {

            vm.areaId_2 = data.value;

        });
        //总校立即提交
        form.on('submit(submitStudent)', function (data) {
            console.log(1)
            vm.sfType=data.field.sfType;//证件类型
            vm.carId=data.field.carId;//准驾车型
            console.log(data);
            getsubimit(0)
            return false
        });
        //提交数据
        function getsubimit(type){
            var myState=  type
            var data = {
                name: vm.name,//姓名
                sex: vm.sex,//性别
                nation: vm.nation,//民族
                birthday: vm.birthday,//出生日期：
                address: vm.address,//地址  身份证上的地址
                certificatesNumber: vm.certificatesNumber,//证件号码
                issuedAt: vm.issuedAt,//签发机关
                effectedDate: vm.effectedDate,//身份证有效期 开始
                expiredDate: vm.expiredDate,//身份证有效期 结束
                picture: vm.picture,//图片编码
                country: vm.country,//国籍
                studyType: vm.studyType,//学习类别
                phone: vm.phone,//手机号码
                carId: vm.carId,//准驾车型
                stayAddreeNumber: vm.stayAddreeNumber,//暂住证编号：
                email: vm.email,//电子邮箱
                registeredAreaId: vm.registeredAreaId,//所属辖区
                addressDetailed: vm.addressDetailed,//住所详细地址：
                registeredSource: vm.registeredSource,//报名来源
                registeredRegionId: vm.registeredRegionId,//登记住所行政区划：
                registeredResidence: vm.registeredResidence,//登记住所详细地址：
                studentSource: vm.studentSource,//来源
                registeredTuition: vm.registeredTuition,//学费
                studentNumber: vm.studentNumber,//学员编号
                registeredTime: vm.registeredTime,//报名日期
                sfType:vm.sfType,//证件类型
                //  driversId : document.all['driversId'].value,//(驾校)结构名称  后台获取
                referralCode: vm.referralCode,//(推荐码
                reason: vm.reason,//(备注
                myState: myState, //提交给谁
                SAMID: vm.SAMID,//模块号码：
                PictureLen: vm.PictureLen,//编码长度
                sfz: vm.sfz,//身份证头像
                mqb: vm.mqb,//互联网面签协议
                cxjs: vm.cxjs,//初学驾驶申请表
                zjjs: vm.zjjs,//增驾驾驶申请表
                zw: vm.zw,//指纹
                ljz: vm.ljz,//原驾驶证
                zzz: vm.zzz,//制证照
                pxjl: vm.pxjl,//培训记录
                xszm: vm.xszm,//学时证明
                zzpermit: vm.zzpermit,//居住证照片
                idz: vm.idz,//身份证正面
                idf: vm.idf,//身份证反面
                healthForm: vm.healthForm,//体检表
                scenePhotos: vm.scenePhotos,//现场照片
                zjzo: vm.zjzo,//证件照
                tjbtp: vm.tjbtp,//提交表图片
                sfzdzz: vm.sfzdzz,//身份证电子照片
                zcbmqz: vm.zcbmqz,//册表面签照
                provId_1: vm.provId_1,
                cityId_1: vm.cityId_1,
                areaId_1: vm.areaId_1,
                provId_2: vm.provId_2,
                cityId_2: vm.cityId_2,
                areaId_2: vm.areaId_2,
            }
            ax.post({
                url: schoolWebUrl+"/api/student/add",
                data: data,
                contentType: "application/x-www-form-urlencoded",
                success: function (data) {
                    layer.msg(data.message);
                    if (data.code == 0) {
                        //刷新父页面
                        // parent.location.reload();
                        // layer.closeAll("iframe");
                        listStudent();
                    } else {

                    }
                }
            });
            return false;
        }

        form.on('select(county)', function (data) {
            vm.country=data.value;//证件类型
        });

        //保存
        form.on('submit(submitStudentMy)', function (data) {
            vm.sfType=data.field.sfType;//证件类型
            vm.carId=data.field.carId;//准驾车型
            getsubimit(1)
            return false
        });
        var  userId=1;
        //图片上传 简便方法
        var addCoachLicense = upload.render({

            elem: '#upload',
            url: fileUploadUrl + "?appId=" + appId + "&userId=" + userId + "&type=" + type,
            before: function (obj) {
                //预读本地文件示例，不支持ie8
                /*obj.preview(function(index, file, result){
                    $('#demo1').attr('src', result); //图片链接（base64）
                });*/
            },
            done: function (res) {
                //上传成功
                if (vm.type == 'cxjs') {
                    vm.cxjs = res.data
                }
                if (vm.type == 'mqb') {
                    vm.mqb = res.data
                }
                if (vm.type == 'zw') {
                    vm.zw = res.data
                }
                if (vm.type == 'zjzo') {
                    vm.zjzo = res.data
                }
                if (vm.type == 'ljz') {
                    vm.ljz = res.data
                }
                if (vm.type == 'idz') {
                    vm.idz = res.data
                }
                if (vm.type == 'idf') {
                    vm.idf = res.data
                }
                if (vm.type == 'tjbtp') {
                    vm.tjbtp = res.data
                }
                if (vm.type == 'scenePhotos') {
                    vm.scenePhotos = res.data
                }
                if (vm.type == 'sfzdzz') {
                    vm.sfzdzz = res.data
                }
                if (vm.type == 'zcbmqz') {
                    vm.zcbmqz = res.data
                }
                if (vm.type == 'zzpermit') {
                    vm.zzpermit = res.data
                }
            }
        });

        var initBaseData = function () {
            ax.get({
                url: schoolWebUrl+"/api/student/getBaseData",

                success: function (res) {
                    if (res.code == 0) {
                        baseData = res.data;
                        loadBaseData();
                    } else {
                        layer.msg(res.message);
                    }
                }

            });
        };
        var loadBaseData = function () {

            $("#driversId").val(baseData.driverName);
            $("#studentNumber").val(baseData.studentNumber);
            // 初始  证件
            $("#sfType").empty();
            $("#sfType").append("<option value=''>请选择</option>");
            $.each(baseData.zjTypeList, function (index, zj) {
                $("#sfType").append("<option value='" + zj.id + "'>" + zj.code + "</option>");
            });

            // 准驾车型列表
            $("#carId").empty();
            $("#carId").append("<option value=''>请选择</option>");
            $.each(baseData.carTypeList, function (index, carType) {
                $("#carId").append("<option value='" + carType.id + "'>" + carType.code + "</option>");
            });

            // 所属辖区
            $("#registeredAreaId").empty();
            $("#registeredAreaId").append("<option value=''>请选择</option>");
            $.each(baseData.quyuAddressList, function (index, address) {
                $("#registeredAreaId").append("<option value='" + address.id + "'>" + address.code + "</option>");
            });

            //登记住所行政区划
            $("#registeredRegionId").empty();
            $("#registeredRegionId").append("<option value=''>请选择</option>");
            $.each(baseData.xzAddressTimeList, function (index, address) {
                $("#registeredRegionId").append("<option value='" + address.id + "'>" + address.code + "</option>");
            });

            form.render('select');
            baseDataDone = true;

        };
        initBaseData();
        ///////////////////////

    });


    function saveBean(state) {
        var data = {
            name: document.all['Name'].value,//姓名
            sex: document.all['Sex'].value,//性别
            nation: document.all['Nation'].value,//民族
            birthday: document.all['Born'].value,//出生日期：
            address: document.all['Address'].value,//地址  身份证上的地址
            certificatesNumber: document.all['CardNo'].value,//证件号码
            issuedAt: document.all['IssuedAt'].value,//签发机关
            effectedDate: document.all['EffectedDate'].value,//身份证有效期 开始
            expiredDate: document.all['ExpiredDate'].value,//身份证有效期 结束
            picture: "data:image/png;base64," + document.all['Picture'].value,//图片编码
            sfType: document.all['sfType'].value,//证件类型
            country: document.all['country'].value,//国籍
            studyType: $("input[name='stu']:checked").val(),//学习类别
            phone: document.all['phone'].value,//手机号码
            carId: document.all['carId'].value,//准驾车型
            stayAddreeNumber: document.all['stayAddreeNumber'].value,//暂住证编号：
            email: document.all['email'].value,//电子邮箱
            registeredAreaId: document.all['registeredAreaId'].value,//所属辖区
            addressDetailed: document.all['addressDetailed'].value,//住所详细地址：
            registeredSource: document.all['registeredSource'].value,//报名来源
            registeredRegionId: document.all['registeredRegionId'].value,//登记住所行政区划：
            registeredResidence: document.all['registeredResidence'].value,//登记住所详细地址：
            studentSource: document.all['studentSource'].value,//来源
            registeredTuition: document.all['registeredTuition'].value,//学费
            studentNumber: document.all['studentNumber'].value,//学员编号
            registeredTime: document.all['registeredTime'].value,//报名日期
            //  driversId : document.all['driversId'].value,//(驾校)结构名称  后台获取
            referralCode: document.all['referralCode'].value,//(推荐码
            reason: document.all['reason'].value,//(备注
            myState: state //提交给谁
        }
        return data;
    }


    function listStudent() {
        window.location.href = 'studentList.html';


    }


    // function yanz(data) {
    //     var checkResult = true;
    //     if (nullOrUndefined(data.name.length)) {
    //         layer.msg("姓名不能为空");
    //         checkResult = false;
    //     }
    //     if (nullOrUndefined(data.sex)) {
    //         layer.msg("性别不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.nation)) {
    //         layer.msg("民族不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.birthday)) {
    //         layer.msg("出生日期不能为空");
    //         return false;
    //     }
    //
    //     if (nullOrUndefined(data.address)) {
    //         layer.msg("身份证上的地址不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.certificatesNumber)) {
    //         layer.msg("证件号码不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.issuedAt)) {
    //         layer.msg("签发机关不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.effectedDate)) {
    //         layer.msg("身份证有效期不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.expiredDate)) {
    //         layer.msg("身份证有效期不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.sfType)) {
    //         layer.msg("证件类型不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.country)) {
    //         layer.msg("国籍不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.studyType)) {
    //
    //         layer.msg("学习类别不能为空!");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.phone)) {
    //         layer.msg("手机号码不能为空");
    //         return false;
    //     }
    //     if (!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(data.phone))) {
    //         layer.msg("手机号码格式不对");
    //         return false;
    //     }
    //
    //     if (nullOrUndefined(data.carId)) {
    //         layer.msg("准驾车型不能为空");
    //         return false;
    //     }
    //     if (nullOrUndefined(data.email)) {
    //         layer.msg("电子邮箱不能为空");
    //         return false;
    //     }
    //     var regex = /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;
    //     if (!regex.test(data.email)) {
    //         layer.msg("您输入的电子邮件地址不合法");
    //         return false;
    //     }
    //     //TODO 后面的在加
    //
    //     return checkResult;
    // }

    // function nullOrUndefined(data) {
    //
    //     if (data == "" || data == undefined || data == null) {
    //         return true;
    //     }
    //     return false;
    // }
</script>

</html>